package org.ehe.erp.enums.stock;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * ERP 库存盘点状态枚举
 * @author :zhangnn
 * @className :ErpStockCheckStatusEnum
 * @description: TODO
 * @date 2025-08-28 17:32:27
 */
@Getter
@AllArgsConstructor
public enum ErpStockCheckStatusEnum {
    DRAFT(0, "草稿"),
    IN_PROGRESS(1, "盘点中"),
    COMPLETED(2, "已完成"),
    CANCELLED(3, "已取消");

    private final Integer code;
    private final String name;

    public static ErpStockCheckStatusEnum getByCode(Integer code) {
        for (ErpStockCheckStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code) {
        ErpStockCheckStatusEnum status = getByCode(code);
        return status != null ? status.getName() : null;
    }
}
